<template>
  <BasicPanel v-if="showPanel">
    <a-tab-pane key="2" :tab="t('表单设置')" v-if="isMainStartNode"><SettingList /></a-tab-pane>
    <a-tab-pane key="3" :tab="t('参数操作')" v-if="isMainStartNode">
      <ParameterOperation
    /></a-tab-pane>
    <a-tab-pane key="3" :tab="t('发起人设置')" v-if="!isMainStartNode">
      <FormItem :label="t('发起人：')">
        <a-select
          v-model:value="formInfo.subProcessInitiator"
          :placeholder="t('请选择发起人')"
          style="width: 100%"
        >
          <a-select-option v-for="item in configInfo.nodeList" :key="item.id" :value="item.id">
            {{ item.name }}
          </a-select-option>
        </a-select>
      </FormItem>

      <FormItem label="" class="pl-6">
        <p class="text-red-600">{{
          t(
            '备注：发起人设置请不要选择子流程之后的节点作为发起人！（无法获取到发起人，子流程将无法进行）',
          )
        }}</p>
      </FormItem>
    </a-tab-pane>
  </BasicPanel>
</template>

<script setup lang="ts">
  import useStateFormInfo from '/@bpmn/hooks/useStateFormInfo';
  import BasicPanel from '/@bpmn/components/BasicPanel.vue';
  import FormItem from '/@bpmn/layout/FormItem.vue';
  import SettingList from '/@bpmn/components/formSettings/SettingList.vue';
  import ParameterOperation from '/@bpmn/components/parameters/ParameterOperation.vue';
  import { NodesConfig } from '/@/model/workflow/memberSetting';
  import { getMainProcessNodeList } from '/@bpmn/config/info';
  import { onMounted, reactive } from 'vue';
  import { useI18n } from '/@/hooks/web/useI18n';
  const { t } = useI18n();
  const { showPanel, formInfo, isMainStartNode } = useStateFormInfo();
  let configInfo: { nodeList: Array<NodesConfig> } = reactive({
    nodeList: [],
  });
  onMounted(() => {
    configInfo.nodeList = getMainProcessNodeList();
  });
</script>

<style scoped></style>
